/* 
 * File:   assignment2.h
 * Author: Mist
 *
 * Created on October 9, 2009, 3:15 PM
 */

#ifndef _ASSIGNMENT2_H
#define	_ASSIGNMENT2_H

#include "syscall.h"
#include "copyright.h"


// Following decelaration are for patient receptionist interaction

/* Function-    InitializePatient
 * Parameters-  Number of Patient
 */
void InitializePatient(int num);
void Patient(int PatientId);

/* Function-    InitializeReceptionist
 * Parameters-  Number of Receptionist
 */
void InitializeReceptionist(int num);
void Receptionist(int ReceptionistId);

/* Function-    InitializeDoctor
 * Parameters-  Number of Doctor
 */
void InitializeDoctor(int num);
void Doctor(int DoctorId);
void DoorBoy(int DoorBoyId);

/* Function-    ShortestQueue
 * Description- Finds the shortest queue
 * Returns-     The offest of the queue
 */
int ShortestQueue(int Queue[], int QueueSize);
int RandomNumber(int min, int max);

// Variables used for patient receptionist interaction

int PatientReceptionistBuffer;
int Token;
int NumberOfReceptionist;
int *ReceptionistQueue;

char *ReceptionistQueueLock;
char **ReceptionistQueueCV;
char **PatientReceptionistLock;
char **PatientReceptionistCV;
char *ReceptionistTokenLock;

// Variables used for patient doctor doorboy interaction

int NumberOfDoctors;
int *DoctorQueue;
int *PatientDoctorBuffer;

char *DoctorQueueLock;
char **DoctorQueueCV;
char **PatientDoctorLock;
char **PatientDoctorCV;

int *DoctorList;

char *DoctorListLock;
char **DoctorDoorBoyLock;
char **DoctorDoorBoyCV;
char **DoctorCV;

#endif	/* _ASSIGNMENT2_H */


